/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-07-16
 * Time: 15:58
 */
public class demo3{
    public static String toLowercase(String s){
        StringBuilder stringBuilder=new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char ch=s.charAt(i);
            if(Character.isLetter(ch)){
                if(Character.isUpperCase(ch)){
                    ch=(char)(ch+32);
                }
            }
        stringBuilder.append(ch);
        }
        return stringBuilder.toString();
    }

    public static int wordNum(String s){
        String[] strings=s.split(" ");
        return strings.length;

    }


    public static void main(String[] args) {
//        String s="LOVELY";
//        String ret=toLowercase(s);
//        System.out.println(ret);
        String s="Hello, my name is John.";
        int count=wordNum(s);
        System.out.println(count);

    }

}
